#!/bin/bash

DIR="/opt/django/iClouds"
LOGDIR="/opt/logs/django"

sourcelogpath="${LOGDIR}/uwsgi_server.log"
touchfile="${DIR}/.uwsgiConfig"

DATE=`date -d "yesterday" +"%Y-%m-%d"`
destlogpath="${LOGDIR}/uwsgi_server.log.${DATE}"

BACKUP=10

find ${LOGDIR} -mtime +${BUCKUP} -name "uwsgi_server.log*" -exec rm -rf {} \;

mv $sourcelogpath $destlogpath

touch $touchfile

# crontab
# 0 0 * * * /bin/bash /opt/iClouds/uwsgiTouch.sh